home *** CD-ROM | disk | FTP | other *** search
/ Suzy B Software 2 / Suzy B Software CD-ROM 2 (1994).iso / new_file / mintprgs / mint112 / mint112d.lzh / appendix.d < prev    next >
Encoding:
Text File  |  1994-11-15  |  18.1 KB  |  575 lines

  1. Appendix D: filesys.h
  2.  
  3. /*
  4.  * Symbolic constants and structures for file system operations.
  5.  *
  6.  * NOTE: This file only works if sizeof(int) == 2!
  7.  * UNLESS: you have an ANSI compiler and use prototypes
  8.  *
  9.  * Copyright 1991,1992 Eric R. Smith.
  10.  * Copyright 1993,1994 Atari Corporation.
  11.  */
  12.  
  13. #ifndef _filesys_h
  14. #define _filesys_h
  15.  
  16. #ifndef P_
  17. # ifdef __STDC__
  18. #  define P_(x) x
  19. # else
  20. #  define P_(x) ()
  21. # endif
  22. #endif
  23.  
  24. #include "portab.h"    /* define WORD to be a 16 bit integer */
  25.  
  26. #define NAME_MAX 32
  27. #define PATH_MAX 128
  28.  
  29. struct filesys;        /* forward declaration */
  30. struct devdrv;        /* ditto */
  31.  
  32. typedef struct f_cookie {
  33.     struct filesys *fs;    /* filesystem that knows about this cookie */
  34.     unsigned short    dev;        /* device info (e.g. Rwabs device number) */
  35.     unsigned short    aux;        /* extra data that the file system may want */
  36.     long    index;        /* this+dev uniquely identifies a file */
  37. } fcookie;
  38.  
  39. /* structure for opendir/readdir/closedir */
  40. typedef struct dirstruct {
  41.     fcookie fc;        /* cookie for this directory */
  42.     unsigned short    index;        /* index of the current entry */
  43.     unsigned short    flags;        /* flags (e.g. tos or not) */
  44. #define TOS_SEARCH    0x01
  45.     char    fsstuff[60];    /* anything else the file system wants */
  46.                 /* NOTE: this must be at least 45 bytes */
  47. } DIR;
  48.  
  49. /* structure for getxattr */
  50. typedef struct xattr {
  51.     unsigned short    mode;
  52. /* file types */
  53. #define S_IFMT    0170000        /* mask to select file type */
  54. #define S_IFCHR    0020000        /* BIOS special file */
  55. #define S_IFDIR    0040000        /* directory file */
  56. #define S_IFREG 0100000        /* regular file */
  57. #define S_IFIFO 0120000        /* FIFO */
  58. #define S_IMEM    0140000        /* memory region or process */
  59. #define S_IFLNK    0160000        /* symbolic link */
  60.  
  61. /* special bits: setuid, setgid, sticky bit */
  62. #define S_ISUID    04000
  63. #define S_ISGID 02000
  64. #define S_ISVTX    01000
  65.  
  66. /* file access modes for user, group, and other*/
  67. #define S_IRUSR    0400
  68. #define S_IWUSR 0200
  69. #define S_IXUSR 0100
  70. #define S_IRGRP 0040
  71. #define S_IWGRP    0020
  72. #define S_IXGRP    0010
  73. #define S_IROTH    0004
  74. #define S_IWOTH    0002
  75. #define S_IXOTH    0001
  76. #define DEFAULT_DIRMODE (0777)
  77. #define DEFAULT_MODE    (0666)
  78.     long    index;
  79.     unsigned short    dev;
  80.     unsigned short    reserved1;
  81.     unsigned short    nlink;
  82.     unsigned short    uid;
  83.     unsigned short    gid;
  84.     long    size;
  85.     long    blksize, nblocks;
  86.     short    mtime, mdate;
  87.     short    atime, adate;
  88.     short    ctime, cdate;
  89.     short    attr;
  90.     short    reserved2;
  91.     long    reserved3[2];
  92. } XATTR;
  93.  
  94. typedef struct fileptr {
  95.     short    links;        /* number of copies of this descriptor */
  96.     unsigned short    flags;        /* file open mode and other file flags */
  97.     long    pos;        /* position in file */
  98.     long    devinfo;    /* device driver specific info */
  99.     fcookie    fc;        /* file system cookie for this file */
  100.     struct devdrv *dev; /* device driver that knows how to deal with this */
  101.     struct fileptr *next; /* link to next fileptr for this file */
  102. } FILEPTR;
  103.  
  104. /* lock structure */
  105. struct flock {
  106.     short l_type;            /* type of lock */
  107. #define F_RDLCK        O_RDONLY
  108. #define F_WRLCK        O_WRONLY
  109. #define F_UNLCK        3
  110.     short l_whence;            /* SEEK_SET, SEEK_CUR, SEEK_END */
  111.     long l_start;            /* start of locked region */
  112.     long l_len;            /* length of locked region */
  113.     short l_pid;            /* pid of locking process
  114.                         (F_GETLK only) */
  115. };
  116.  
  117. /* LOCK structure used by the kernel internally */
  118.  
  119. typedef struct ilock {
  120.     struct flock l;
  121.     struct ilock *next;
  122.     long  reserved[4];
  123. } LOCK;
  124.  
  125. typedef struct devdrv {
  126.     long (*open)    P_((FILEPTR *f));
  127.     long (*write)    P_((FILEPTR *f, char *buf, long bytes));
  128.     long (*read)    P_((FILEPTR *f, char *buf, long bytes));
  129.     long (*lseek)    P_((FILEPTR *f, long where, WORD whence));
  130.     long (*ioctl)    P_((FILEPTR *f, WORD mode, void *buf));
  131.     long (*datime)    P_((FILEPTR *f, WORD *timeptr, WORD rwflag));
  132.     long (*close)    P_((FILEPTR *f, WORD pid));
  133.     long (*select)    P_((FILEPTR *f, long proc, WORD mode));
  134.     void (*unselect) P_((FILEPTR *f, long proc, WORD mode));
  135.     long    reserved[3];    /* reserved for future use */
  136. } DEVDRV;
  137.  
  138. typedef struct filesys {
  139.     struct    filesys    *next;    /* link to next file system on chain */
  140.     long    fsflags;
  141. #define FS_KNOPARSE    0x01    /* kernel shouldn't do parsing */
  142. #define FS_CASESENSITIVE    0x02    /* file names are case sensitive */
  143. #define FS_NOXBIT    0x04    /* if a file can be read, it can be executed */
  144. #define    FS_LONGPATH    0x08    /* file system understands "size" argument to
  145.                    "getname" */
  146.  
  147.     long    (*root) P_((WORD drv, fcookie *fc));
  148.     long    (*lookup) P_((fcookie *dir, char *name, fcookie *fc));
  149.     long    (*creat) P_((fcookie *dir, char *name, unsigned WORD mode,
  150.                 WORD attrib, fcookie *fc));
  151.     DEVDRV *(*getdev) P_((fcookie *fc, long *devspecial));
  152.     long    (*getxattr) P_((fcookie *fc, XATTR *xattr));
  153.     long    (*chattr) P_((fcookie *fc, WORD attr));
  154.     long    (*chown) P_((fcookie *fc, WORD uid, WORD gid));
  155.     long    (*chmode) P_((fcookie *fc, unsigned WORD mode));
  156.     long    (*mkdir) P_((fcookie *dir, char *name, unsigned WORD mode));
  157.     long    (*rmdir) P_((fcookie *dir, char *name));
  158.     long    (*remove) P_((fcookie *dir, char *name));
  159.     long    (*getname) P_((fcookie *relto, fcookie *dir, char *pathname,
  160.                 WORD size));
  161.     long    (*rename) P_((fcookie *olddir, char *oldname,
  162.                 fcookie *newdir, char *newname));
  163.     long    (*opendir) P_((DIR *dirh, WORD tosflag));
  164.     long    (*readdir) P_((DIR *dirh, char *nm, WORD nmlen, fcookie *fc));
  165.     long    (*rewinddir) P_((DIR *dirh));
  166.     long    (*closedir) P_((DIR *dirh));
  167.     long    (*pathconf) P_((fcookie *dir, WORD which));
  168.     long    (*dfree) P_((fcookie *dir, long *buf));
  169.     long    (*writelabel) P_((fcookie *dir, char *name));
  170.     long    (*readlabel) P_((fcookie *dir, char *name, WORD namelen));
  171.     long    (*symlink) P_((fcookie *dir, char *name, char *to));
  172.     long    (*readlink) P_((fcookie *dir, char *buf, WORD len));
  173.     long    (*hardlink) P_((fcookie *fromdir, char *fromname,
  174.                 fcookie *todir, char *toname));
  175.     long    (*fscntl) P_((fcookie *dir, char *name, WORD cmd, long arg));
  176.     long    (*dskchng) P_((WORD drv));
  177.     long    (*release) P_((fcookie *fc));
  178.     long    (*dupcookie) P_((fcookie *dest, fcookie *src));
  179.  
  180. } FILESYS;
  181.  
  182. /*
  183.  * this is the structure passed to loaded file systems to tell them
  184.  * about the kernel
  185.  */
  186.  
  187. typedef long (*_LongFunc)();
  188.  
  189. struct kerinfo {
  190.     short    maj_version;    /* kernel version number */
  191.     short    min_version;    /* minor kernel version number */
  192.     unsigned short default_mode;    /* default file access mode */
  193.     short    reserved1;    /* room for expansion */
  194.  
  195. /* OS functions */
  196.     _LongFunc *bios_tab;     /* pointer to the BIOS entry points */
  197.     _LongFunc *dos_tab;    /* pointer to the GEMDOS entry points */
  198.  
  199. /* media change vector */
  200.     void    (*drvchng) P_((short));
  201.  
  202. /* Debugging stuff */
  203.     void    (*trace) P_((char *, ...));
  204.     void    (*debug) P_((char *, ...));
  205.     void    (*alert) P_((char *, ...));
  206.     void    (*fatal) P_((char *, ...));
  207.  
  208. /* memory allocation functions */
  209.     void *    (*kmalloc) P_((long));
  210.     void    (*kfree) P_((void *));
  211.     void *    (*umalloc) P_((long));
  212.     void    (*ufree) P_((void *));
  213.  
  214. /* utility functions for string manipulation */
  215.     short    (*strnicmp) P_((char *, char *, WORD));
  216.     short    (*stricmp) P_((char *, char *));
  217.     char *    (*strlwr) P_((char *));
  218.     char *    (*strupr) P_((char *));
  219.     short    (*sprintf) P_((char *, char *, ...));
  220.  
  221. /* utility functions for manipulating time */
  222.     void    (*millis_time) P_((unsigned long, WORD *));
  223.     long    (*unixtim) P_((unsigned WORD, unsigned WORD));
  224.     long    (*dostim) P_((long));
  225.  
  226. /* utility functions for dealing with pauses */
  227.     void    (*nap) P_((unsigned WORD));
  228.     void    (*sleep) P_((WORD que, long cond));
  229.     void    (*wake) P_((WORD que, long cond));
  230.     void    (*wakeselect) P_((long param));
  231.  
  232. /* file system utility functions */
  233.     short    (*denyshare) P_((FILEPTR *, FILEPTR *));
  234.     LOCK *    (*denylock) P_((LOCK *, LOCK *));
  235.  
  236. /* timeout functions: available only in MiNT 1.06 and later */
  237.     long    (*addtimeout) P_((long delta, void (*func)(void)));
  238.     void    (*canceltimeout) P_((long));
  239.  
  240. /* extended timeout functions; MiNT 1.11 and later only */
  241.     struct timeout * ARGS_ON_STACK (*addroottimeout) P_((long, void (*)(), short));
  242.     void    ARGS_ON_STACK (*cancelroottimeout) P_((struct timeout *));
  243.  
  244. /* miscellaneous other things: MiNT 1.12 and later only */
  245.     long    ARGS_ON_STACK (*ikill) P_((int, int));
  246.     void    ARGS_ON_STACK (*iwake) P_((int que, long cond, short pid));
  247.  
  248. /* reserved for future use */
  249.     long    res2[3];
  250. };
  251.  
  252. /* flags for open() modes */
  253. #define O_RWMODE      0x03    /* isolates file read/write mode */
  254. #    define O_RDONLY    0x00
  255. #    define O_WRONLY    0x01
  256. #    define O_RDWR    0x02
  257. #    define O_EXEC    0x03    /* execute file; used by kernel only */
  258.  
  259. #define O_APPEND    0x08    /* all writes go to end of file */
  260.  
  261. #define O_SHMODE    0x70    /* isolates file sharing mode */
  262. #    define O_COMPAT    0x00    /* compatibility mode */
  263. #    define O_DENYRW    0x10    /* deny both read and write access */
  264. #    define O_DENYW    0x20    /* deny write access to others */
  265. #    define O_DENYR    0x30    /* deny read access to others */
  266. #    define O_DENYNONE 0x40    /* don't deny any access to others */
  267.  
  268. #define O_NOINHERIT    0x80    /* children don't get this file descriptor */
  269.  
  270. #define O_NDELAY    0x100    /* don't block for i/o on this file */
  271. #define O_CREAT        0x200    /* create file if it doesn't exist */
  272. #define O_TRUNC        0x400    /* truncate file to 0 bytes if it does exist */
  273. #define O_EXCL        0x800    /* fail open if file exists */
  274.  
  275. #define O_USER        0x0fff    /* isolates user-settable flag bits */
  276.  
  277. #define O_GLOBAL    0x1000    /* for Fopen: opens a global file handle */
  278.  
  279. /* kernel mode bits -- the user can't set these! */
  280. #define O_TTY        0x2000    /* FILEPTR refers to a terminal */
  281. #define O_HEAD        0x4000    /* FILEPTR is the master side of a fifo */
  282. #define O_LOCK        0x8000    /* FILEPTR has had locking Fcntl's performed */
  283.  
  284.  
  285. /* GEMDOS file attributes */
  286.  
  287. /* macros to be applied to FILEPTRS to determine their type */
  288. #define is_terminal(f) (f->flags & O_TTY)
  289.  
  290. /* lseek() origins */
  291. #define    SEEK_SET    0        /* from beginning of file */
  292. #define    SEEK_CUR    1        /* from current location */
  293. #define    SEEK_END    2        /* from end of file */
  294.  
  295. /* The requests for Dpathconf() */
  296. #define DP_IOPEN    0    /* internal limit on # of open files */
  297. #define DP_MAXLINKS    1    /* max number of hard links to a file */
  298. #define DP_PATHMAX    2    /* max path name length */
  299. #define DP_NAMEMAX    3    /* max length of an individual file name */
  300. #define DP_ATOMIC    4    /* # of bytes that can be written atomically */
  301. #define DP_TRUNC    5    /* file name truncation behavior */
  302. #    define    DP_NOTRUNC    0    /* long filenames give an error */
  303. #    define    DP_AUTOTRUNC    1    /* long filenames truncated */
  304. #    define    DP_DOSTRUNC    2    /* DOS truncation rules in effect */
  305. #define DP_CASE        6    /* file name case conversion behavior */
  306. #    define    DP_CASESENS    0    /* case sensitive */
  307. #    define    DP_CASECONV    1    /* case always converted */
  308. #    define    DP_CASEINSENS    2    /* case insensitive, preserved */
  309. #define DP_MODEATTR        7
  310. #    define    DP_ATTRBITS    0x000000ffL    /* mask for valid TOS attribs */
  311. #    define    DP_MODEBITS    0x000fff00L    /* mask for valid Unix file modes */
  312. #    define    DP_FILETYPS    0xfff00000L    /* mask for valid file types */
  313. #    define    DP_FT_DIR    0x00100000L    /* directories (always if . is there) */
  314. #    define    DP_FT_CHR    0x00200000L    /* character special files */
  315. #    define    DP_FT_BLK    0x00400000L    /* block special files, currently unused */
  316. #    define    DP_FT_REG    0x00800000L    /* regular files */
  317. #    define    DP_FT_LNK    0x01000000L    /* symbolic links */
  318. #    define    DP_FT_SOCK    0x02000000L    /* sockets, currently unused */
  319. #    define    DP_FT_FIFO    0x04000000L    /* pipes */
  320. #    define    DP_FT_MEM    0x08000000L    /* shared memory or proc files */
  321. #define DP_XATTRFIELDS    8
  322. #    define    DP_INDEX    0x0001
  323. #    define    DP_DEV        0x0002
  324. #    define    DP_RDEV        0x0004
  325. #    define    DP_NLINK    0x0008
  326. #    define    DP_UID        0x0010
  327. #    define    DP_GID        0x0020
  328. #    define    DP_BLKSIZE    0x0040
  329. #    define    DP_SIZE        0x0080
  330. #    define    DP_NBLOCKS    0x0100
  331. #    define    DP_ATIME    0x0200
  332. #    define    DP_CTIME    0x0400
  333. #    define    DP_MTIME    0x0800
  334. #define DP_MAXREQ    8    /* highest legal request */
  335.  
  336. /* Dpathconf and Sysconf return this when a value is not limited
  337.    (or is limited only by available memory) */
  338.  
  339. #define UNLIMITED    0x7fffffffL
  340.  
  341. /* various character constants and defines for TTY's */
  342. #define MiNTEOF 0x0000ff1a    /* 1a == ^Z */
  343.  
  344. /* defines for tty_read */
  345. #define RAW    0
  346. #define COOKED    0x1
  347. #define NOECHO    0
  348. #define ECHO    0x2
  349. #define ESCSEQ    0x04        /* cursor keys, etc. get escape sequences */
  350.  
  351. /* constants for various Fcntl commands */
  352. /* constants for Fcntl calls */
  353. #define F_DUPFD        0        /* handled by kernel */
  354. #define F_GETFD        1        /* handled by kernel */
  355. #define F_SETFD        2        /* handled by kernel */
  356. #    define FD_CLOEXEC    1    /* close on exec flag */
  357.  
  358. #define F_GETFL        3        /* handled by kernel */
  359. #define F_SETFL        4        /* handled by kernel */
  360. #define F_GETLK        5
  361. #define F_SETLK        6
  362. #define F_SETLKW    7
  363.  
  364. #define FSTAT        (('F'<< 8) | 0)    /* handled by kernel */
  365. #define FIONREAD    (('F'<< 8) | 1)
  366. #define FIONWRITE    (('F'<< 8) | 2)
  367. #define TIOCGETP    (('T'<< 8) | 0)
  368. #define TIOCSETP    (('T'<< 8) | 1)
  369. #define TIOCSETN    TIOCSETP
  370. #define TIOCGETC    (('T'<< 8) | 2)
  371. #define TIOCSETC    (('T'<< 8) | 3)
  372. #define TIOCGLTC    (('T'<< 8) | 4)
  373. #define TIOCSLTC    (('T'<< 8) | 5)
  374. #define TIOCGPGRP    (('T'<< 8) | 6)
  375. #define TIOCSPGRP    (('T'<< 8) | 7)
  376. #define TIOCFLUSH    (('T'<< 8) | 8)
  377. #define TIOCSTOP    (('T'<< 8) | 9)
  378. #define TIOCSTART    (('T'<< 8) | 10)
  379. #define TIOCGWINSZ    (('T'<< 8) | 11)
  380. #define TIOCSWINSZ    (('T'<< 8) | 12)
  381. #define TIOCGXKEY    (('T'<< 8) | 13)
  382. #define TIOCSXKEY    (('T'<< 8) | 14)
  383. #define TIOCIBAUD    (('T'<< 8) | 18)
  384. #define TIOCOBAUD    (('T'<< 8) | 19)
  385. #define TIOCCBRK    (('T'<< 8) | 20)
  386. #define TIOCSBRK    (('T'<< 8) | 21)
  387. #define TIOCGFLAGS    (('T'<< 8) | 22)
  388. #define TIOCSFLAGS    (('T'<< 8) | 23)
  389. #define TIOCOUTQ    (('T'<< 8) | 24)
  390. #define TIOCSETP    (('T'<< 8) | 25)
  391. #define TIOCHPCL    (('T'<< 8) | 26)
  392. #define TIOCCAR        (('T'<< 8) | 27)
  393. #define TIOCNCAR    (('T'<< 8) | 28)
  394. #define TIOCWONLINE    (('T'<< 8) | 29)
  395. #define TIOCSFLAGSB    (('T'<< 8) | 30)
  396. #define TIOCGSTATE    (('T'<< 8) | 31)
  397. #define TIOCSSTATEB    (('T'<< 8) | 32)
  398. #define TIOCGVMIN    (('T'<< 8) | 33)
  399. #define TIOCSVMIN    (('T'<< 8) | 34)
  400.  
  401. #define TCURSOFF    (('c'<< 8) | 0)
  402. #define TCURSON        (('c'<< 8) | 1)
  403. #define TCURSBLINK    (('c'<< 8) | 2)
  404. #define TCURSSTEADY    (('c'<< 8) | 3)
  405. #define TCURSSRATE    (('c'<< 8) | 4)
  406. #define TCURSGRATE    (('c'<< 8) | 5)
  407.  
  408. #define PPROCADDR    (('P'<< 8) | 1)
  409. #define PBASEADDR    (('P'<< 8) | 2)
  410. #define PCTXTSIZE    (('P'<< 8) | 3)
  411. #define PSETFLAGS    (('P'<< 8) | 4)
  412. #define PGETFLAGS    (('P'<< 8) | 5)
  413. #define PTRACESFLAGS    (('P'<< 8) | 6)
  414. #define PTRACEGFLAGS    (('P'<< 8) | 7)
  415. #    define    P_ENABLE    (1 << 0)    /* enable tracing */
  416.  
  417. #define PTRACEGO    (('P'<< 8) | 8)
  418. #define PTRACEFLOW    (('P'<< 8) | 9)
  419. #define PTRACESTEP    (('P'<< 8) | 10)
  420. #define PTRACE11    (('P'<< 8) | 11)    /* unused, reserved */
  421. #define PLOADINFO    (('P'<< 8) | 12)
  422. #define    PFSTAT        (('P'<< 8) | 13)
  423.  
  424. struct ploadinfo {
  425.     /* passed */
  426.     short fnamelen;
  427.     /* returned */
  428.     char *cmdlin, *fname;
  429. };
  430.  
  431. #define SHMGETBLK    (('M'<< 8) | 0)
  432. #define SHMSETBLK    (('M'<< 8) | 1)
  433.  
  434.  
  435. /* terminal control constants (tty.sg_flags) */
  436. #define T_CRMOD        0x0001
  437. #define T_CBREAK    0x0002
  438. #define T_ECHO        0x0004
  439. #define T_RAW        0x0010
  440. #define T_TOS        0x0080
  441. #define T_TOSTOP    0x0100
  442. #define T_XKEY        0x0200        /* Fread returns escape sequences for
  443.                        cursor keys, etc. */
  444. #define T_ECHOCTL    0x0400        /* echo ctl chars as ^x */
  445.  
  446. #define T_TANDEM    0x1000
  447. #define T_RTSCTS    0x2000
  448. #define T_EVENP        0x4000        /* EVENP and ODDP are mutually exclusive */
  449. #define T_ODDP        0x8000
  450.  
  451. #define TF_FLAGS    0xF000
  452.  
  453. /* some flags for TIOC[GS]FLAGS */
  454. #define TF_CAR        0x800        /* nonlocal mode, require carrier */
  455. #define TF_NLOCAL    TF_CAR
  456.  
  457. #define TF_BRKINT    0x80        /* allow breaks interrupt (like ^C) */
  458.  
  459. #define TF_STOPBITS    0x0003
  460. #define TF_1STOP    0x0001
  461. #define TF_15STOP    0x0002
  462. #define    TF_2STOP    0x0003
  463.  
  464. #define TF_CHARBITS    0x000C
  465. #define TF_8BIT        0
  466. #define TF_7BIT        0x4
  467. #define TF_6BIT        0x8
  468. #define TF_5BIT        0xC
  469.  
  470. /* the following are terminal status flags (tty.state) */
  471. /* (the low byte of tty.state indicates a part of an escape sequence still
  472.  * hasn't been read by Fread, and is an index into that escape sequence)
  473.  */
  474. #define TS_ESC        0x00ff
  475. #define TS_HOLD        0x1000        /* hold (e.g. ^S/^Q) */
  476. #define TS_COOKED    0x8000        /* interpret control chars */
  477.  
  478. /* structures for terminals */
  479. struct tchars {
  480.     char t_intrc;
  481.     char t_quitc;
  482.     char t_startc;
  483.     char t_stopc;
  484.     char t_eofc;
  485.     char t_brkc;
  486. };
  487.  
  488. struct ltchars {
  489.     char t_suspc;
  490.     char t_dsuspc;
  491.     char t_rprntc;
  492.     char t_flushc;
  493.     char t_werasc;
  494.     char t_lnextc;
  495. };
  496.  
  497. struct sgttyb {
  498.     char sg_ispeed;
  499.     char sg_ospeed;
  500.     char sg_erase;
  501.     char sg_kill;
  502.     unsigned short sg_flags;
  503. };
  504.  
  505. struct winsize {
  506.     short    ws_row;
  507.     short    ws_col;
  508.     short    ws_xpixel;
  509.     short    ws_ypixel;
  510. };
  511.  
  512. struct xkey {
  513.     short    xk_num;
  514.     char    xk_def[8];
  515. };
  516.  
  517. struct tty {
  518.     short        pgrp;        /* process group of terminal */
  519.     short        state;        /* terminal status, e.g. stopped */
  520.     short        use_cnt;    /* number of times terminal is open */
  521.     short        res1;        /* reserved for future expansion */
  522.     struct sgttyb     sg;
  523.     struct tchars     tc;
  524.     struct ltchars     ltc;
  525.     struct winsize    wsiz;
  526.     long        rsel;        /* selecting process for read */
  527.     long        wsel;        /* selecting process for write */
  528.     char        *xkey;        /* extended keyboard table */
  529.     long        hup_ospeed;    /* saved ospeed while hanging up */
  530.     unsigned short    vmin, vtime;    /* min chars, timeout for RAW reads */
  531.     long        resrvd[1];    /* for future expansion */
  532. };
  533.  
  534. /* defines and declarations for Dcntl operations */
  535.  
  536. #define DEV_INSTALL    0xde02
  537. #define DEV_NEWBIOS    0xde01
  538. #define DEV_NEWTTY    0xde00
  539.  
  540. struct dev_descr {
  541.     DEVDRV    *driver;
  542.     short    dinfo;
  543.     short    flags;
  544.     struct tty *tty;
  545.     long    devdrvsiz;        /* size of DEVDRV struct */
  546.     long    reserved[4];
  547. };
  548.  
  549. #define FS_INSTALL    0xf001  /* let the kernel know about the file system */
  550. #define FS_MOUNT      0xf002  /* make a new directory for a file system */
  551. #define FS_UNMOUNT    0xf003  /* remove a directory for a file system */
  552. #define FS_UNINSTALL  0xf004  /* remove a file system from the list */
  553.  
  554.  
  555. struct fs_descr
  556. {
  557.     FILESYS *file_system;
  558.     short dev_no;    /* this is filled in by MiNT if arg == FS_MOUNT*/
  559.     long flags;
  560.     long reserved[4];
  561. };
  562.  
  563.  
  564. /* defines for TOS attribute bytes */
  565. #ifndef FA_RDONLY
  566. #define           FA_RDONLY           0x01
  567. #define           FA_HIDDEN           0x02
  568. #define           FA_SYSTEM           0x04
  569. #define           FA_LABEL               0x08
  570. #define           FA_DIR               0x10
  571. #define           FA_CHANGED           0x20
  572. #endif
  573.  
  574. #endif /* _filesys_h */
  575.